package com.twq.patternmatch.pattern.kinds

import com.twq.patternmatch.basic.{UnOp, Var}

/**
 * Created by tangweiqun on 2017/12/8.
 * 模式的种类-变量绑定
 */
object VariableBinding {
  def main(args: Array[String]): Unit = {
    val expr = UnOp("abs", UnOp("abs", Var("x")))
    expr match {
      case UnOp("abs", e@UnOp("abs", i@Var(_))) => println(e + " " + i) //通过@变量绑定
      case _ =>
    }
  }
}